#pragma
#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;

class PeoInfo
{
public:
	PeoInfo()
	{}
	PeoInfo(const string& name, const size_t& age, const string& sex, const string& tele, const string& addr)
		:_name(name), _age(age), _sex(sex), _tele(tele), _addr(addr)
	{}
	PeoInfo(const PeoInfo& p)
		:_name(p._name), _age(p._age), _sex(p._sex), _tele(p._tele), _addr(p._addr)
	{}
	string GetPeoName()const
	{
		return _name;
	}
	size_t GetPeoAge()const
	{
		return _age;
	}
	string GetPeoSex()const
	{
		return _sex;
	}
	string GetPeoTele()const
	{
		return _tele;
	}
	string GetPeoAddr()const
	{
		return _addr;
	}
	bool operator==(const PeoInfo& p)const
	{
		return _name == p._name&&_age == p._age&&_sex == p._sex&&_tele == p._tele&&_addr == p._addr;
	}
private:
	string _name;
	size_t _age;
	string _sex;
	string _tele;
	string _addr;
};

class Contact
{
	friend ostream& operator<<(ostream& out, const Contact& con);
public:
	Contact();
	Contact(const vector<PeoInfo>& p, size_t size = 0, size_t capacity = 0);
	~Contact();
	size_t GetSize()const;
	size_t GetCapacity()const;
	vector<PeoInfo> GetList()const;
	Contact& Add(const string& name, const size_t& age, const string& sex, const string& tele, const string& addr);
	Contact& Add(const PeoInfo& p);
	size_t SearchByName(const string& name);
	size_t SearchByTele(const string& tele);
	void Delete(size_t pos);
	void Modify(PeoInfo& p,size_t pos);
	Contact FilterSex(const string& sex);
	Contact FilterAge(const size_t& ageL,const size_t& ageR);
	Contact FilterAddr(const string& addr);
private:
	vector<PeoInfo> _list;
	size_t _size;
	size_t _capacity;
};

void AddContact(Contact& con);

void Delete(Contact& con);

void SearchContactByName(Contact& con);

void SearchContactByTele(Contact& con);

void ModifyContact(Contact& con);

void ShowContact(Contact& con);

void FilterBySex(Contact& con);

void FilterByAge(Contact& con);

void FilterByAddress(Contact& con);

void SortByNameAsorder(Contact& con);

void SortByAgeAsorder(Contact& con);

void Load(Contact& con);